package edu.towson.greenteam.menu;

import java.util.ArrayList;
import edu.towson.greenteam.ClockTick;

public class MenuItem implements ClockTick {

    private int id;
    private String name;
    private String description;
    private Price price;
    private ArrayList<Integer> ratings;
    private int maxQty;
    private int currentQty;
    private Category category;
    private int prepTime;
    private String imageURL = "default.png";

    public MenuItem(String name, Price price, int maxQty) {
        this.name = name;
        this.price = price;
        this.maxQty = maxQty;
        this.currentQty = maxQty;   //not sure if this ok trying to get simulator working sub 1 when order is placed
    }

    public MenuItem(String name, String description, Price price, int maxQty, int prepTime) {
        this.name = name;
        this.description = description;
        this.price = price;
        this.maxQty = maxQty;
        this.currentQty = maxQty;    //ditto
        this.prepTime = prepTime;
    }

    public MenuItem(String name, String description, Price price, int maxQty, Category category, int prepTime) {
        this.name = name;
        this.description = description;
        this.price = price;
        this.maxQty = maxQty;
        this.currentQty = maxQty;    //ditto
        this.prepTime = prepTime;
    }

    public MenuItem(int id, String name, String description, Price price, int rating,
            int maxQty, int currentQty) {
        this.id = id;
        this.name = name;
        this.description = description;
        this.price = price;
        this.ratings.clear();
        this.ratings.add(rating);
        this.maxQty = maxQty;
        this.currentQty = currentQty;
    }

    public MenuItem(int id, String name, String description, Price price, int rating,
            int maxQty, int currentQty, Category category) {
        this.id = id;
        this.name = name;
        this.description = description;
        this.price = price;
        this.ratings.clear();
        this.ratings.add(rating);
        this.maxQty = maxQty;
        this.currentQty = currentQty;
        this.category = category;
    }

    public MenuItem getMenuItem() {
        return this;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Price getPrice() {
        return price;
    }

    public void setPrice(Price price) {
        this.price = price;
    }

    public float getCurrentPrice() {
        return price.getCurrentPrice();
    }

    public void setCurrentPrice(float price) {
        this.price.setCurrentPrice(price);
    }

    public float getStandardPrice() {
        return price.getStandardPrice();
    }

    public void setStandardPrice(float price) {
        this.price.setStandardPrice(price);
    }

    public int getRating() {
        if (!ratings.isEmpty()) {
            int sum = 0;
            for (Integer i : ratings) {
                sum = sum + i;
            }
            int average = sum / ratings.size();
            return average;
        } else {
            return -1;
        }
    }

    public void setRating(int rating) {
        ratings.add(rating);
    }

    public int getMaxQty() {
        return maxQty;
    }

    public void setMaxQty(int maxQty) {
        this.maxQty = maxQty;
    }

    public int getCurrentQty() {
        return currentQty;
    }

    public void setCurrentQty(int currentQty) {
        this.currentQty = currentQty;
    }

    public Category getCategory() {
        return category;
    }

    public void setCategory(Category category) {
        this.category = category;
    }

    public int getPrepTime() {
        return prepTime;
    }

    public void setPrepTime(int prepTime) {
        this.prepTime = prepTime;
    }

    public String getImageURL() {
        return imageURL;
    }

    public void setImageURL(String imageURL) {
        this.imageURL = imageURL;
    }

    public void adjustPrice() {
        
    }

    @Override
    public void clockTick() {
        // TODO Auto-generated method stub

    }
    
}